package datapackage

//Cube 数据立方体
type Cube struct {
	Name              string             `xml:"name,attr"`
	Caption           string             `xml:"caption,attr"`
	Table             Table              `xml:"Table"`
	DimensionUsages   []DimensionUsage   `xml:"DimensionUsage"`
	Measures          []Measure          `xml:"Measure"`
	CalculatedMembers []CalculatedMember `xml:"CalculatedMember"`
	RedisIndex        int                `xml:"redisIndex"`
	Aggregates        []Aggregate        `xml:"Aggregate"`
	BuildPeriod       string             `xml:"buildPeriod,attr"`
}

//Measure 度量值
type Measure struct {
	Name         string `xml:"name,attr"`
	Column       string `xml:"column,attr"`
	Caption      string `xml:"caption,attr"`
	Aggregator   string `xml:"aggregator,attr"`
	FormatString string `xml:"formatString,attr"`
}

//CalculatedMemberProperty 计算成员属性
type CalculatedMemberProperty struct {
	Name  string `xml:"name,attr"`
	Value string `xml:"value,attr"`
}

//CalculatedMember 计算成员
type CalculatedMember struct {
	Name       string                     `xml:"name,attr"`
	Dimension  string                     `xml:"dimension,attr"`
	Formula    string                     `xml:"formula,attr"`
	Properties []CalculatedMemberProperty `xml:"CalculatedMemberProperty"`
}

//VirtualCubeDimension 虚拟立方体维度
type VirtualCubeDimension struct {
	Source string `xml:"source,attr"`
	Name   string `xml:"name,attr"`
}

//VirtualCubeMeasure 虚拟立方体度量
type VirtualCubeMeasure struct {
	CubeName string `xml:"cubeName,attr"`
	Name     string `xml:"name,attr"`
}

//CubeUsage 虚拟立方体引用
type CubeUsage struct {
	CubeName                  string `xml:"cubeName,attr"`
	IgnoreUnrelatedDimensions bool   `xml:"ignoreUnrelatedDimensions,attr"`
}

//CubeUsages 虚拟立方体引用列表
type CubeUsages struct {
	CubeUsages []CubeUsage `xml:"CubeUsage"`
}

//VirtualCube 虚拟立方体
type VirtualCube struct {
	Name              string                 `xml:"name,attr"`
	Caption           string                 `xml:"caption,attr"`
	Dimensions        []VirtualCubeDimension `xml:"VirtualCubeDimension"`
	Measures          []VirtualCubeMeasure   `xml:"VirtualCubeMeasure"`
	CalculatedMembers []CalculatedMember     `xml:"CalculatedMember"`
	CubeUsages        CubeUsages
}

//Aggregate 聚合
type Aggregate struct {
	Name       string   `xml:"name,attr"`
	RedisIndex int      `xml:"redisIndex,attr"`
	Dimensions []string `xml:"Dimension"`
}
